create table [Type]
(
	 [TypeId] int identity(1, 1) primary key
	,[TypeName] nvarchar(128)
	,[TypeOf] int
	,[CreatedBy] int
	,[CreatedDate] datetime
	,[UpdatedBy] int
	,[UpdatedDate] datetime
	,[Status] int
)
go

CREATE PROCEDURE TypeGet
	@TypeId int
AS
SELECT *
FROM [Type]
WHERE [Type].[TypeId] = @TypeId
GO

CREATE PROCEDURE TypeList
AS
SELECT *
FROM [Type]
ORDER BY TypeId DESC
GO

CREATE PROCEDURE TypeInsert
	 @TypeName nvarchar(128)
	,@TypeOf int
	,@CreatedBy int
	,@CreatedDate datetime
	,@UpdatedBy int
	,@UpdatedDate datetime
	,@Status int
AS

INSERT INTO [Type] (
	 [TypeName]
	,[TypeOf]
	,[CreatedBy]
	,[CreatedDate]
	,[UpdatedBy]
	,[UpdatedDate]
	,[Status]
	
) VALUES (
	 @TypeName
	,@TypeOf
	,@CreatedBy
	,@CreatedDate
	,@UpdatedBy
	,@UpdatedDate
	,@Status
	
)

select SCOPE_IDENTITY()
GO

CREATE PROCEDURE TypeUpdate
	@TypeId int, 
	@TypeName nvarchar(128), 
	@TypeOf int, 
	@CreatedBy int, 
	@CreatedDate datetime, 
	@UpdatedBy int, 
	@UpdatedDate datetime, 
	@Status int 

AS

UPDATE [Type] SET
	   [TypeName] = @TypeName
	   ,[TypeOf] = @TypeOf
	   ,[CreatedBy] = @CreatedBy
	   ,[CreatedDate] = @CreatedDate
	   ,[UpdatedBy] = @UpdatedBy
	   ,[UpdatedDate] = @UpdatedDate
	   ,[Status] = @Status
WHERE [Type].[TypeId] = @TypeId
GO

CREATE PROCEDURE TypeDelete
	@TypeId int
AS
DELETE FROM [Type]
WHERE [Type].[TypeId] = @TypeId
GO